package com.cserver.pro.threadtest;


//农民起义军
public class ArmyThread  extends Thread{

   volatile boolean keepRunning=true;

    public ArmyThread(String name){
        super(name);
    }
    @Override
    public void run() {
        //发动五连击
        while(keepRunning){
            for (int i=1;i<=5;i++){
                System.out.println(Thread.currentThread().getName()+"开始进攻对方"+"["+i+"]");
                Thread.yield();
            }
        }

        System.out.println(Thread.currentThread().getName()+"结束战争");
    }
}
